import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class HomeTopbarDate extends StatelessWidget {
  const HomeTopbarDate({super.key});

  String get day {
    DateTime dateTime = DateTime.now();
    return dateTime.day.toString();
  }

  String get month {
    DateTime dateTime = DateTime.now();
    String month = '未知';
    switch (dateTime.month) {
      case 1:
        month = '一月';
        break;
      case 2:
        month = '二月';
        break;
      case 3:
        month = '三月';
        break;
      case 4:
        month = '四月';
        break;
      case 5:
        month = '五月';
        break;
      case 6:
        month = '六月';
        break;
      case 7:
        month = '七月';
        break;
      case 8:
        month = '八月';
        break;
      case 9:
        month = '九月';
        break;
      case 10:
        month = '十月';
        break;
      case 11:
        month = '十一月';
        break;
      case 12:
        month = '十二月';
        break;
      default:
        break;
    }
    return month;
  }

  @override
  Widget build(BuildContext context) {
    return Row(children: [
      SizedBox(width: 20.0.w),
      Column(mainAxisAlignment: MainAxisAlignment.center, children: [
        Text(day, style: TextStyle(fontSize: 18.sp, fontWeight: FontWeight.w800)),
        Text(month, style: TextStyle(fontSize: 11.sp, fontWeight: FontWeight.w600))
      ]),
      SizedBox(width: 16.0.w),
      VerticalDivider(
          width: 2.0,
          thickness: 1.0,
          color: Colors.grey.shade300,
          indent: 12.0.w,
          endIndent: 8.0.w)
    ]);
  }
}
